package com.gmrz.webauthn.protocol.v1.json;

import com.gmrz.webauthn.protocol.v1.schema.CollectedClientData;
import com.gmrz.webauthn.protocol.v1.schema.PublicKeyCredentialParameters;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;


public class WebAuthnSchemaBuilder {
    private static WebAuthnSchemaBuilder INSTANCE = new WebAuthnSchemaBuilder();


    private GsonBuilder builder = null;

    private WebAuthnSchemaBuilder() {
        this.builder = getBuilder();
    }

    public static Gson getGson() {
        return INSTANCE.builder.create();
    }

    public static GsonBuilder getBuilder() {


        return new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
                .registerTypeAdapter(PublicKeyCredentialParameters.class, new PublicKeyCredentialParametersAdapter())
                .registerTypeAdapter(CollectedClientData.class, new CollectedClientDataAdapter());
    }
}
